//

package user.ucm;

import user.model.UserModel;

public class UserInformation implements UCController {

    private UserModel user;
    private boolean state = true;

    public UserInformation(UserModel user) {
        this.user = user;
        this.state = true;
    }

    public UserInformation(UserModel user, boolean state) {
        this.user = user;
        this.state = state;
    }

    public int run() {
        if (user.getName().isEmpty() || user.getPsw().isEmpty()) {
            return 1;
        } else if (user.getName().length() > 12 || user.getName().length()<3) {
            return 2;
        } else if (user.getPsw().length() > 12 || user.getPsw().length() < 6) {
            return 3;
        } else if (state == false && user.getName().length() > 20) {
            return 4;
        } else {
            return 0;
        }
    }
}
